<script setup>
import {useRouter} from 'vue-router'

const router = useRouter();

const goDetail=(id)=>{
    // router.push("/Admin/Detail/01001");
    router.push({name:'Detail',params:{id:'01001'}});
}

</script>

<template>
    <h1>音乐列表（路由传参：用params）</h1>
    <ul>
        <li>
            <!-- 传值： -->
            <router-link to="/Admin/Detail/01001">分手快乐(params，字符串传值)</router-link>
        </li>
        <li>
            <router-link :to="{name:'Detail',params:{id:'01001'}}" >分手快乐(params，对象方式传值)</router-link>
        </li>
        <li >
           <span @click="goDetail('01001')"> 分手快乐(params，对象方式传值，编程式写法)</span>
        </li>
        <li>
            <router-link to="/Admin/Detail/01002">有一种爱叫做放手</router-link>
        </li>
    </ul>
</template>

<style  scoped></style>
